package com.pansky.crm.common.mybatisplus;

/**
 * @author ：zhouzhiyong
 * @date ：Created in 2021/2/22 15:45
 * @description：BaseErrorCode
 */
public enum BaseErrorCode implements IErrorCode {
    FAILED(-1L, "执行失败"),
    ERROR(-2L, "缺少参数"),
    SUCCESS(0L, "执行成功"),
    TOKEN_INVALID(401L, ""),
    TOKEN_EXPIRE(409L, ""),
    FEIGN_FAIL(509L, "服务调用失败");

    private final long code;
    private final String msg;

    private BaseErrorCode(final long code, final String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BaseErrorCode fromCode(long code) {
        BaseErrorCode[] ecs = values();
        BaseErrorCode[] var3 = ecs;
        int var4 = ecs.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            BaseErrorCode ec = var3[var5];
            if (ec.getCode() == code) {
                return ec;
            }
        }

        return SUCCESS;
    }

    public long getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public Object getData() {
        return null;
    }
}
